import type { IHttpContext, IMiddleware, TNext } from "boot/interface"

export class TimeMiddleware implements IMiddleware {
  async use(ctx: IHttpContext, next: TNext) {
    const start = Date.now()
    await next()
    const ms = Date.now() - start
    console.log(`${ctx.method} ${ctx.url} - ${ms}ms`)
  }
}
